<div class="panel panel-default panel-intro">
    <div class="panel-heading">
        <!--<div class="panel-lead"><em>公司名称：{$order.depid_text}</em>订单号 : {$order.nb} 订单状态： {$order.deliverystatus_text} 制单人：{$order.userid_text}</div>-->
        <ul class="nav nav-tabs">
            <li {if $second == 0} class="active" {/if}><a href="#first" data-toggle="tab">订单详情</a></li>
            <li {if $second == 1} class="active" {/if}><a href="#second" data-toggle="tab">出库/发货记录</a></li>
        </ul>
    </div>
    <div class="panel-body">
        <div id="myTabContent" class="tab-content">
            <div class="tab-pane fade {if $second == 0} active in{/if} " id="first">
                <div id="toolbar"  class="toolbar {if $order.status == 0 || $order.status == 2} {else} hidden {/if}">
                    <a href="javascript:;" class="btn btn-primary btn-more" data-id="{$order.id}" data-status="2" data-title="您是否要作废此订单 {$order.nb}"> 作废</a>
                    <a href="javascript:;" class="btn btn-success btn-more " data-id="{$order.id}" data-status="1" data-title="您是否要审核通过此订单 {$order.nb}" > 通过</a>
                </div>
                <div class="panel-lead">
                    <legend>{$order.deliverystatus_text}</legend>
                    分公司名称：{$order.depid_text}   订单号 : {$order.nb}  制单人：{$order.userid_text}
                    <hr>
                </div>
                <table id="table1" class="table table-striped table-bordered table-hover" width="100%">
                    <thead>
                    <tr>
                        <th>产品编号</th>
                        <th>产品名称</th>
                        <th>数量</th>
                        <th>分公司库存数量</th>
                        <th>备注</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach name="$orderList" item="vo"}
                    <tr>
                        <td>{$vo.b_n}</td>
                        <td>{$vo.cname}（ {if $vo.type == 1} 半成品 {else} 成品 {/if}）</td>
                        <td>
                            <input type="text"  class="edit-numerb col-xs-4" {if $order.status != 0} disabled {/if} data-id="{$vo.id}" value="{$vo.num}">
                        </td>
                        <td></td>
                        <td>{$vo.remarks}</td>
                        <td>{$vo.status_text}</td>
                        <td><a href="javascript:;" class="btn btn-xs btn-danger {if $order.status == 0} btn-delone {/if} "  data-id="{$vo.id}" data-original-title="删除"><i class="fa fa-trash"></i></a></td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
                <div class="form-group">
                    <div class="row" style="margin-top:10px;">
                        <div class="col-xs-12">
                            <legend>订单详情</legend>
                            <div class="col-xs-12">
                                <label>备注信息:</label>
                                <textarea name="row[remark]" class="form-control remark" {if $order.status != 0} disabled {/if}  rel="result" rows="2" placeholder="请填写备注信息" >{$order.remark}</textarea>
                            </div>
                            <div class="col-xs-12">
                                <label>交货日期:</label>
                                <span class="form-control">{:date('Y-m-d H:i:s',$order.deliverydate)}</span>
                            </div>
                            <div class="col-xs-12">
                                <label>收货信息：</label>
                                <div class="form-control">
                                    <div class="address-add-admin">
                                        <input type="hidden" class="addressId yl-add-del" name="addressid" autocomplete="off" value="{$order.id}">
                                        <em class="yl-add-del">收货人：</em><span class="contactor yl-add-del">{$Githouse.lxr}</span>
                                        <em class="yl-add-del"> 联系电话：</em><span class="mobile yl-add-del">{$Githouse.mobile}</span>
                                        <em class="yl-add-del">收货地址：</em><span class="address yl-add-del">{$Githouse.province_text},{$Githouse.city_text},{$Githouse.area_text},{$Githouse.address}</span>
                                        {if $order.status == 0}
                                        <a href="javascript:void(0)" id="address-edit-admin" data-orderId="{$order.id}" class="gray address-edit">
                                            <i class="fa fa-pencil"></i><span class="ui-btn-txt">修改地址</span></a>
                                        {/if}
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="panel-lead"><h4>操作日志</h4></div>
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th>公司名称</th>
                        <th>操作人</th>
                        <th>时间</th>
                        <th>操作日志</th>
                    </tr>
                    </thead>
                    <tbody>
                        {foreach name="$orderlogList" item="vo"}
                            <tr>
                                <td>{$vo.dep_name}</td>
                                <td>{$vo.username}</td>
                                <td>{:date('Y-m-d H:i:s',$vo.createtime)}</td>
                                <td>{$vo.content}</td>
                            </tr>
                        {/foreach}
                    </tbody>
                </table>
            </div>
            <div class="tab-pane fade {if $second == 1} active in{/if}" id="second">
                {if $orderLists && $order.status == 1}
                <legend>待出库商品清单</legend>
                <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="order/order/Outstock">
                    <div style="float:left;">
                        <label>出库存仓库:</label>
                        <select  name="row[storage]" id="">
                            <option value="1">总公司库存</option>
                            {foreach name="$storageList" item="vo"}
                                <option value="{$key}">{$vo}</option>
                            {/foreach}
                        </select>
                        <input type="hidden" name="row[dep_id]" value="{$order.dep_id}">
                        <input type="hidden" name="row[order_id]" value="{$order.id}">
                    </div>
                    <div style="float:right;">
                        <button type="submit" class="btn btn-success btn-embossed ">出库</button>
                    </div>
                    <table id="table2" class="table table-striped table-bordered table-hover" width="100%">
                        <thead>
                        <tr>
                            <th>产品编号</th>
                            <th>产品名称</th>
                            <th>分公司库存数量</th>
                            <th>订购数</th>
                            <th>备注</th>
                            <th>已出库数</th>
                            <th>本次出库数</th>
                        </tr>
                        </thead>
                        <tbody>
                        {foreach name="$orderLists" item="vo"}
                        <tr>
                            <td>{$vo.b_n}</td>
                            <td>{$vo.cname}（ {if $vo.type == 1} 半成品 {else} 成品 {/if}）</td>
                            <td></td>
                            <td>{$vo.num}</td>
                            <td>{$vo.remarks}</td>
                            <th>{$vo.nums}</th>
                            <th>
                                <input   name="row[orderitem][{$key}][order_id]" type="hidden" value="{$vo.order_id}">
                                <input   name="row[orderitem][{$key}][id]" type="hidden" value="{$vo.id}">
                                <input   name="row[orderitem][{$key}][preproduct_id]" type="hidden"  value="{$vo.preproduct_id}">
                                <input   name="row[orderitem][{$key}][type]" type="hidden"  value="{$vo.type}">
                                <input   name="row[orderitem][{$key}][bcp]" type="hidden"  value="{$vo.bcp}">
                                <input  data-rule="required" class="edit-nums" data-num="{$vo.num - $vo.nums}"  name="row[orderitem][{$key}][nums]" type="number" value="{$vo.num - $vo.nums}">
                            </th>
                        </tr>
                        {/foreach}
                        </tbody>
                    </table>
                </form>
                {/if}

                {if $detailsList}
                    <legend>出库/发货记录</legend>
                    {foreach name="$detailsList" item="vo"}
                        {if $vo.status == 0}
                            <div style="float:right;">
                                <button  data-id="{$vo.id}" class="btn btn-success btn-fahuo ">发货</button>
                            </div>
                        {/if}
                        <table  class="table table-striped table-bordered table-hover" width="100%">
                            <thead>
                            <tr>
                                <th>产品名称</th>
                                <th>本次出库数</th>
                            </tr>
                            </thead>
                            <tbody>
                            {foreach name="$vo.list" item="vos"}
                                <tr>
                                    <td>{$vos.cname}</td>
                                    <td>{$vos.num}</td>
                                </tr>
                            {/foreach}
                            <tr>
                                <td>出库信息	出库编号：{$vo.nb}出库时间：{:date('Y-m-d H:i:s',$vo.createtime)}出库仓库：北京总部
                                </td>
                            </tr>
                            {if $vo.status == 1}
                            <tr>
                                <td>
                                    物流信息	物流日期：{$vo.logistics_time}物流公司：{$vo.logistics}物流单号：{$vo.logistics_nb}物流备注：{$vo.logistics_remark}
                                </td>
                            </tr>
                            {/if}
                            </tbody>
                        </table>
                    {/foreach}
                {/if}
            </div>
        </div>
    </div>
</div>

<div class="hide layer-footer">
    <label class="control-label col-xs-12 col-sm-2"></label>
    <div class="col-xs-12 col-sm-8">
        <button type="reset" class="btn btn-primary btn-embossed btn-close" onclick="Layer.closeAll();">{:__('Close')}</button>
    </div>
</div>